<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/displaytag-11.tld" prefix="display"%>
<%@page import="java.util.*, com.cs.beneficios.business.model.BeneficioVO"%>
<link href="<%= request.getContextPath() + "/css/bloques.css" %>" rel="stylesheet" type="text/css">


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>untitled</title>

</head>
<body>
<script src="<%=request.getContextPath()%>/js/displaytag.js" type="text/javascript"></script>
<logic:iterate id="beneficiario" name="beneSelected" type="com.cs.beneficios.business.model.BeneficiarioVO"> 
<table  cellspacing="3" cellpadding="2" border="0" width="90%" align="center">
    <tr>
        <td class="titulosenblanco">
            <DIV align="center"><STRONG>BENEFICIOS OTORGADOS</STRONG></DIV>
        </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>
        <logic:present name="msg1">
          <strong><DIV align="center"><%=(String)session.getAttribute("msg1")%></DIV></strong>
          <%session.removeAttribute("msg1");%>
          <BR>
        </logic:present>
      <logic:present name="msg">
          <strong><DIV align="center"><%=(String)session.getAttribute("msg")%></DIV></strong>
          <% session.removeAttribute("msg");%>
      </logic:present>
      </td>
    </tr>
    <tr>
         <td>Beneficiario:&nbsp;<strong><bean:write name="beneficiario" property="numeroDocumento"/>&nbsp;&nbsp;-&nbsp;&nbsp; 
         <bean:write name="beneficiario" property="nombre1"/>
         <bean:write name="beneficiario" property="nombre2"/>
         <bean:write name="beneficiario" property="primerApellido"/>
         <bean:write name="beneficiario" property="segundoApellido"/></strong>   
         </td>
    </tr>
    <tr>
      <td align="center">&nbsp;</td>
    </tr>
    <tr>
    <td>
      <logic:notPresent name="beneficios">
          <DIV align="left">El Beneficiario no posee beneficios actualmente.</DIV>
      </logic:notPresent>
 
      <logic:present name="beneficios"> 
          <%
            List beneficios = (List) session.getAttribute("beneficios");
            BeneficioVO beneficio;
          %>
      <form name="form1">
          
          <display:table name="sessionScope.beneficios" pagesize="20" id="bene" requestURI='<%= request.getContextPath() + "/beneficios/VerBeneficios.do" %>' class="bordesTable"  cellpadding="3" cellspacing="1" style="width:100%" >
              <bean:define id="debeRenovar" name="bene" property="renovar"></bean:define>
              <bean:define id="codBeneficio" name="bene" property="code"></bean:define>
              <%
                  String codigo = request.getParameter("code");
                  if(codigo == null){
                    codigo = (String)request.getAttribute("code");
                  }
                  java.util.HashMap params = new java.util.HashMap();
                  params.put("code", codigo);
                  params.put("codBeneficio",codBeneficio);
                  pageContext.setAttribute("parametros", params);
              %>
              <display:column headerClass="headerTable" title="Secretaria" class="Numero" sortable="true" group="1">
                   <div align="center"><bean:write name="bene" property="nomArea" /></div> 
              </display:column>
              <display:column headerClass="headerTable" title="Programa" class="Numero" sortable="true" group="2">
                   <div align="center"><bean:write name="bene" property="nomPrograma" /></div> 
              </display:column>
              <display:column headerClass="headerTable" title="Beneficio" class="Numero" sortable="true">
                   <div align="center"><bean:write name="bene" property="nombre" /> </div> 
              </display:column>
              <display:column headerClass="headerTable" title="Fecha Ultimo Otorgamiento" class="Numero" sortable="true">
                   <div align="center"><bean:write name="bene" property="fecha" /> </div> 
              </display:column>
              <display:column width="10%" align="center" headerClass="headerTable" title="Total por Tipo" class="Numero" sortable="true">
                  <div align="center">
                     <bean:write name="bene" property="numeroBeneficios"/>
                  </div>
              </display:column>
              <display:column width="10%" align="center" headerClass="headerTable" title="Valor" class="Numero" sortable="true">
                  <div align="center">
                     <bean:write name="bene" property="valor"/>
                  </div>
              </display:column>
              <display:column headerClass="headerTable" title="Anteriores Entregas">
                 <div align="center">
                    <logic:notEqual value="" name="bene" property="fecha">
                    <html:link name="parametros" scope="page" page="/beneficiarios/DetalleBeneficios.do">
                        <img src="<%= request.getContextPath() + "/images/ver.gif" %>" width="16" height="16" border="0">
                    </html:link>
                    </logic:notEqual>
                 </div>
              </display:column>
              <display:column headerClass="headerTable" title="Sede Otorgamiento" class="Numero" sortable="true">
                   <div align="center"><bean:write name="bene" property="nomSede" /> </div> 
              </display:column>
              <display:column headerClass="headerTable"  title="Renovar" class="Numero" sortable="true">
                <%
                  if(debeRenovar.equals("Si")){
                %>
                 <html:link onclick="return confirm('Esta seguro que desea Renovar el beneficio por otro periodo?')" name="parametros" scope="page" page="/beneficios/ValidarRenovar.do">
                      <div align="center"><img src="<%= request.getContextPath() + "/images/activar.gif" %>" width="16" height="16" border="0"></div>
                 </html:link>
                 <%}else{%>
                      <!--<div align="center"><img src="<%= request.getContextPath() + "/images/activar1.gif" %>" width="16" height="16" border="0"></div>-->
                 <%}%>
              </display:column>  
              
          </display:table>
      </form>
       <%session.removeAttribute("beneficios");%>
      </logic:present>
    </td>
    </tr>
    <tr>
      <td>
        <html:link paramId="code" paramName="beneficiario" title="Nuevo Beneficio" paramProperty="code" page="/beneficios/OtorgarBeneficios.do">
            <div align="right">Nuevo Beneficio
            <img src="<%= request.getContextPath() + "/images/nuevo.gif" %>" width="16" height="16" border="0"></div>
        </html:link>       
      </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
    
    <tr>
      <%
        String strOption = (String)session.getAttribute("Option");
        java.util.Enumeration enumera = request.getParameterNames();
        java.util.HashMap params = new java.util.HashMap();
        while(enumera.hasMoreElements())
        {
          String key = enumera.nextElement().toString();
          String value = request.getParameter(key);
          params.put(key, value);
        }
 
        params.put("regresar", "1");
        pageContext.setAttribute("parametros", params);
           
        if(strOption == null)
        {
      %>
        <td align="center">
           <input type="hidden" name="code" value="<%=request.getParameter("code")%>"/>
           <html:link name="parametros" scope="page" page="/beneficiarios/Buscar.do"><img src="<%= request.getContextPath() + "/images/b_atras.gif" %>" width="24" height="15" border="0"><br>
           <span class="celdaayd">Atras</span></html:link>
        </td>
      <%
        }else{
      %>
      <td align="center">
         <input type="hidden" name="code" value="<%=session.getAttribute("CodeBeneSelected")%>"/>
         <html:link name="parametros" scope="page" page="/beneficiarios/VerGrupoFamiliar.do"><img src="<%= request.getContextPath() + "/images/b_atras.gif" %>" width="24" height="15" border="0"><br>
         <span class="celdaayd">Atras</span></html:link>
      </td>
      <%
        }
      %>
    </tr>
</table>
<br/>
<logic:present name="msgdar">
  <strong><DIV align="center"><%=(String)session.getAttribute("msgdar")%></DIV></strong>
  <%session.removeAttribute("msgdar");%>
  <BR>
</logic:present>
</logic:iterate>






</body>
</html>
